﻿@model IEnumerable<BussinessLogic.Exercise.ExerciseListItemModel>
@{
    ViewBag.Title = "Index";
}
<p>
    @Html.ActionLink("Create new exercise", "Create") | @Html.ActionLink("Upload photos", "UploadPictures")
</p>
<table>
    <tr>
        <th>
            Name
        </th>
        <th>
            Description
        </th>
        <th>
            Activity Type
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Description)
            </td>
            <td>
                @item.Type
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
                @if (item.Type == BussinessLogic.ActivityType.Exercise)
                {
                    @Html.ActionLink("Protocol", "CreateExercise", new { id = item.ID }) 
                }
                else if (item.Type == BussinessLogic.ActivityType.Questionnaire)
                {
                    @Html.ActionLink("Protocol", "Questionnaire", new { id = item.ID }) 
                }
                else if (item.Type == BussinessLogic.ActivityType.MatrixExercise)
                {
                    @Html.ActionLink("Protocol", "CreateMatrixExercise", new { id = item.ID }) 
                }
                @if (!item.IsRunning)
                {
                    @:| @Html.ActionLink("Delete", "Delete", new { id = item.ID })
                                                
                }
            </td>
        </tr>
    }
</table>
